package com.gfxy.modules.items.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gfxy.modules.items.entity.Xwsjjd;

import com.gfxy.modules.items.mapper.TXwsjjdMapper;
import com.gfxy.modules.items.service.ITXwsjjdService;
import com.gfxy.modules.items.vo.TXwsjjdMenberPage;
import com.gfxy.modules.excel.ExcelUtil;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 校外培训教学基地建设
 * @Author: jeecg-boot
 * @Date:   2021-08-31
 * @Version: V1.0
 */
@Service
public class TXwsjjdServiceImpl extends AbstractProjectServiceImpl<TXwsjjdMapper, Xwsjjd> implements ITXwsjjdService {
	protected int memberCellNum = 2;

	@Override
	protected void pass(String id, String isPass) {

	}

	@Override
	protected String[] getMemberArray(Row row) {
		String nameStrs = ExcelUtil.formatCell(row.getCell(memberCellNum));
		return nameStrs.split(memberNameSeparator);
	}

	@Override
	protected Xwsjjd getOneProject(Row row) {
		String date = ExcelUtil.formatCell(row.getCell(0));
		String projectName = ExcelUtil.formatCell(row.getCell(1));
		Xwsjjd xwsjjd = new Xwsjjd();
		xwsjjd.setDate(date);
		xwsjjd.setProjectName(projectName);
		xwsjjd.setIsPass(0);
		xwsjjd.setTotalScore(this.getTotalScore(xwsjjd));
		return xwsjjd;
	}



	@Override
	public Double getTotalScore(Xwsjjd xwsjjd) {
		double result = 15;
		return result;
	}



	@Override
	public IPage<TXwsjjdMenberPage> getXwsjjdMemberPageListByYear(String date, Integer pageNo, Integer pageSize) {
		Page<TXwsjjdMenberPage> page = new Page<>(pageNo,pageSize);
		return page.setRecords(this.baseMapper.selectTXwsjjdMenberPageListByYear(date));
	}

	@Override
	public List<TXwsjjdMenberPage> getXwsjjdMemberPageListByYear(String date) {
		return this.baseMapper.selectTXwsjjdMenberPageListByYear(date);
	}

}
